1. Technical Field of the Invention
The present invention relates to detecting the cadence of a sequence of video fields.
2. Description of Related Art
The detection of the cadence of a sequence of video fields is based on a search for a cadence pattern, for example “10010”, in a sequence of bits representative of the motion between one field and another. The cadence of a field sequence is understood to mean a repeat of at least one cadence pattern in the sequence of bits representative of the motion between one field and another. Cadence detection may allow one to find the source format of a sequence of video fields, or detect the absence of motion between frames (still pictures).
Several source formats exist. For example, a video camera may capture 50 or 60 frames per second. Film format allows filmed images to be captured at a rate of 24 or 25 frames per second. The number of frames per second may be even smaller, for example about 8 frames per second for some Japanese animation.
There are also multiple display formats. The PAL standard (Phase Alternating Line), primarily used in Europe, displays 50 fields per second. The NTSC format (National Television Standards Committee), primarily used in the United States, displays 60 fields per second.
The standards commonly used in television specify encoding the source frames into successive interlaced fields (half a frame), where fields containing the even lines of pixels in a given frame for display are interlaced, or in other words alternate, with fields containing only the odd lines of pixels in a next frame for display. More generally, an image is subdivided into one field, two fields, or even more, depending on the scanning mode. In this document, the term “field” covers a complete image, half of an image, and even smaller fractions of an image. A “sequence of video fields” is understood not to be limited to the video format in particular, but simply indicates that a field corresponds to a frame or a portion of a frame.
Thus, when a sequence of frames in film format at 25 frames per second is encoded in the PAL format at 50 Hz, each film frame is subdivided into two interlaced fields. In another example, when a sequence of video frames at 50 frames per second is encoded in the PAL standard, each frame is reduced into an alternating even and odd field containing half a frame. In another example, when a sequence of frames in film format at 24 frames per second is encoded in the NTSC format at 60 fields per second, each sequence of four consecutive film frames is converted into a sequence of ten fields containing half a frame. In these ten fields, the first three come for example from the same film frame, the next two fields come from a second film frame, etc. Thus, two of the first three fields are identical. Such a conversion is called a 3:2 pulldown.
Other types of conversion also exist. There is the 2:2 pulldown which converts a film format of 24 or 25 frames per second to the PAL format at 50 Hz, the 2:3 pulldown which converts a 24 frames per second format to an NTSC format, the 3:2:3:2:2 pulldown when a television station eliminates one field out of twelve in a sequence originating from film frames, 2:2:2:4 and 2:3:3:2 conversions for frames captured in a DVCAM format, 5:5, 6:4 or 8:7 conversions for frames of animated cartoons, etc.
Cadence detection is based on comparisons of pixels belonging to successive fields of index n, performed in order to determine the existence of motion between one frame and another. A conversion typically leads to abrupt motion variations. For example, in a 3:2 pulldown, three fields n−3, n−2, n−1, originate from the same film frame, so no motion is detected between these fields. The next two fields n, n+1 originate from another film frame. Relatively substantial motion may be detected between the third field n−1 and the fourth field n, while the motion between the fourth field n and the fifth field n+1 is essentially zero. By analyzing a sequence of bits representative of the motion, called a motion sequence, determined by comparisons of pixels in a field sequence, one may identify a repeating pattern and thus detect that a conversion has been performed. Cadence detection is therefore based on an analysis of motion sequences.
Cadence detection may be used in a variety of applications. For example, a cadence detector may be combined with a deinterlacing device or a compression device. If a particular cadence is detected, the processing may be done relatively simply, for example by the simple merging of fields in the case of deinterlacing.
In addition to conversion, the fields of a frame sequence may be repeated and/or skipped in a more or less regular rhythm. In particular, it may be necessary to adapt the scanning parameters of a source format to a display format. Scanning parameters include such characteristics as the number of fields for a frame (typically one or two), the number of lines per frame, the number of lines in an odd field and in an even field, the number of active lines per frame, the number of samples per line, the number of active samples per line, the sampling rate, the line rate, the field rate, a phase difference between vertical and horizontal synchronizing signals, etc.
To adapt these scanning parameters from a source format to a display format, fields may be regularly repeated or skipped. This is called scan format conversion. For example, to adapt a format of 50 fields per second to a format of 60 fields per second, a field may be repeated every five fields. For other source and/or display formats, for example a source format of 59.95 fields per second and a display format of 60 fields per second, the data steam may be regulated using a control loop.
More generally, there are numerous types of image processing, for example, to improve contrast or quality or to perform deinterlacing. These lead to the temporary storage of image data in buffers. Here again, a flow control loop may be used to control the flow of data into buffers and avoid overflow in particular.
A flow control loop allows tying some or all of these parameters to the desired format. Control commands are used, for example, clock control commands to affect the sampling rate, or line control commands to control the number of lines scanned per field by affecting the line rate, for example. Control commands may also comprise field control commands in order to repeat or skip a field. These operations at the field level may occur when the flow control loop is in a non-steady state, to accelerate the establishing of a steady state. A flow control loop may thus lead to irregular field repeats/skips. Fields may therefore be skipped or repeated, for the purposes of regulating the data stream in particular.
Field skips and repeats affect cadence detection. For example, in a sequence of fields resulting from a 3:2 pulldown, a motion sequence such as “100101001010010 . . . ” is expected. Skipping the third field results in the motion sequence “10101001010010 . . . ”, which corresponds to a 2:2 pulldown for the first six fields. A repeat of the third field results in the motion sequence “1000101001010010 . . . ”. In these two cases, there is a risk of incorrectly detecting a break in the cadence, or even erroneously detecting a cadence.
There is a need in the art to eliminate the effects of field skips or repeats on cadence detection.